﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpenseSystem.Common;
using ExpenseSystem.Common.BaseModel;
using ExpenseSystem.DataUpdater;
using ExpenseSystem.Fether;
using ExpenseSystem.Model;
using ExpenseSystem.Core.DataAddOn;
using System.Web;

namespace ExpenseSystem.Core.ProductionModules
{
    public class UnitGroupManager : INormalManager<UnitGroupModel>
    {
        protected UserProfile userProfile = Authority.Authority.GetUserProfile();
        UnitGroupFetcher fetcher = new UnitGroupFetcher();
        protected NormalDataUpdater<UnitGroupModel> UnitGroupUpdater = new UnitGroupUpdaterRegister().GetUnitGroupUpdater();
        protected string tran = HttpContext.Current.Items[Definition.SESSION_TRAN_STR].ToString();

        public virtual bool Delete(UnitGroupModel role, out string message)
        {
            bool result = UnitGroupUpdater.Remove(role, tran, fetcher, out message);
            return result;
        }
        public virtual bool DeleteById(long[] UnitGroupId,  out string message)
        {
            bool result = true;
            result = UnitGroupUpdater.RemoveById(userProfile.SiteId, UnitGroupId, tran, fetcher, out message);
            return result;
        }
        public virtual bool Save(UnitGroupModel UnitGroup,  out string message, params IAddable<UnitGroupModel>[] addables)
        {
            return UnitGroupUpdater.Save(UnitGroup, tran, fetcher, out message);
        }

    }
}
